package service

import (
	"example.com/m/v2/model/mysql"
	"example.com/m/v2/types"
	"gorm.io/gorm"
)

type Cate struct {
	BaseService
	db *gorm.DB
}

func NewCate(svcCtx *ServiceContext, db *gorm.DB) *Cate {
	res := Cate{db: db, BaseService: BaseService{svcCtx: svcCtx}}
	return &res
}

func (cate *Cate) GetList(req *types.DesignCateReq) *[]mysql.Cate {
	var cates []mysql.Cate
	cate.db.Where("type=?", req.Type).Find(&cates)
	return &cates
}
